package com.example.demo.service;


import com.example.demo.common.enums.EnumResultCode;
import com.example.demo.common.exception.BusinessException;

/**
 * 手机号异常
 */
public class MobileException extends RuntimeException {

    private static final long serialVersionUID = 2678145046723789238L;
    private int errorCode = EnumResultCode.ERROR.getCode();
    private String message = null;

    public int getErrorCode() {
        return this.errorCode;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    public MobileException(int errorCode, String msg) {
        this.errorCode = errorCode;
        this.message = msg;
    }

    public MobileException(String message, Throwable cause) {
        super(cause);
        this.message = message;
    }

    public static void throwBusinessException(EnumResultCode resultCodeEnum) {
        throw new BusinessException(resultCodeEnum.getCode(), resultCodeEnum.getMessage());
    }

}
